package cn.cloud9.designpattern.dp02factory.methodfactory;

import cn.cloud9.designpattern.dp02factory.methodfactory.method.ICourseFactory;
import cn.cloud9.designpattern.dp02factory.methodfactory.method.JavaCourseFactoryImpl;
import cn.cloud9.designpattern.dp02factory.methodfactory.method.PythonCourseFactoryImpl;
import cn.cloud9.designpattern.dp02factory.simplefactory.product.Course;

/**
 * @author OnCloud9
 * @description
 *  https://www.bilibili.com/video/BV1L5411R7BP?p=3
 *  工厂方法模式(Fatory Method Pattern) 是指定义一个创建对象的接口，
 *  但让实现这个接口的类来决定实例化哪个类，工厂方法让类的实例化推迟到子类中进行。
 * @project Java
 * @date 2022年05月22日 10:24
 */
public class MethodFactory {

    public static void main(String[] args) {
        ICourseFactory courseFactory = new JavaCourseFactoryImpl();
        Course course = courseFactory.create();
        course.record();

        courseFactory = new PythonCourseFactoryImpl();
        course = courseFactory.create();
        course.record();
    }

}
